package leetcode.solution;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author : zx
 * @version V1.0
 */
public class BaoShu {

    public static boolean hasChar(String s, char c){
        for (char i : s.toCharArray()){
            if (i == c){
                return true;
            }
        }
        return false;
    }

    public static void main(String[] args){
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        int n = 0;
        int r = 0;
        int[] jybd = new int[]{0,0,0,0};
        try{
            n = Integer.parseInt(reader.readLine());
        }catch (IOException e){ }

        for (int i = 1; i <= n+r; i++){
            if (i % 7 == 0 || hasChar(String.valueOf(i), '7')){
                jybd[(i-1)%4]++;
                r++;
            }
        }
        for (int i : jybd){
            System.out.println(i);
        }
    }
}
